package dp;

/**
 * @author pengfei.hpf
 * @date 2020/2/10
 * @verdion 1.0.0
 */
public class RobHouse {

    public int rob(int[] nums) {
        if(nums == null || nums.length < 1){
            return 0;
        }
        int rob_i = 0;
        int rob_i_1 = 0;
        for(int i = 0; i < nums.length; i ++){
            int tmp = rob_i;
            rob_i = Math.max(rob_i, rob_i_1 + nums[i]);
            rob_i_1 = tmp;
        }
        return rob_i;
    }
}
